﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title></title>
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/assets/materialize/css/materialize.min.css"
	media="screen,projection" />
<!-- Bootstrap Styles-->
<link href="${pageContext.request.contextPath}/assets/css/bootstrap.css"
	rel="stylesheet" />
<!-- FontAwesome Styles-->
<link
	href="${pageContext.request.contextPath}/assets/css/font-awesome.css"
	rel="stylesheet" />
<!-- Morris Chart Styles-->
<link
	href="${pageContext.request.contextPath}/assets/js/morris/morris-0.4.3.min.css"
	rel="stylesheet" />
<!-- Custom Styles-->
<link
	href="${pageContext.request.contextPath}/assets/css/custom-styles.css"
	rel="stylesheet" />
<!-- Google Fonts-->
<!-- jQuery Js -->
<script
	src="${pageContext.request.contextPath}/assets/js/jquery-1.10.2.js"></script>
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/assets/js/Lightweight-Chart/cssCharts.css">
<style>
.font {
	font-size: 24px;
}

.top-navbar .navbar-brand {
	background: #2C445A;
}

.top-navbar .navbar-brand:hover {
	background: #0F2A3F;
}
</style>
</head>
<body>
	<script>
		$(function(){
			getUserById();
		});
		
			function regist(){
				var userid = $("#userid").val();
				var username = $("#username").val();
				var name = $("#name").val();
				var password = $("#password").val();
				var password2 = $("#password2").val();
				$.ajax({
					url:"${pageContext.request.contextPath}/system/user/updateUser",
					type:"POST",				
					data:{
						"userid":userid,
						"name":name,
						"username":username,
						"password":password,
						"isdel":0,
						},
					dataType:"json",
					success:function(data){
						alert("修改成功！！");
						window.location.href="${pageContext.request.contextPath}/system/user/togetalluser";
					},
					error:function(){
						alert("请先选择修改用户！！");
					}
				});
			}
		function getUserById(){
    		$.ajax({
    			url:"${pageContext.request.contextPath}/system/user/getUserById",
    			type:"GET",
    			dataType:"json",
    			success:function(data){		
    			var name=data.name;	
    			$("#name").append(name) ;	
					
    			},
    		});
    	
    };
		</script>
	<div id="wrapper">
		<nav class="navbar navbar-default top-navbar" role="navigation">
			<div class="navbar-header">
				<button type="button" class="navbar-toggle" data-toggle="collapse"
					data-target=".sidebar-collapse">
					<span class="sr-only">Toggle navigation</span> <span
						class="icon-bar"></span> <span class="icon-bar"></span> <span
						class="icon-bar"></span>
				</button>
				<a class="navbar-brand waves-effect waves-dark" href="index.html"><strong>壁纸之家</strong>
				</a>
			</div>

			<ul class="nav navbar-top-links navbar-right">
				<li><a class="dropdown-button waves-effect waves-dark" href="#"
					data-activates="dropdown1"><i class="fa fa-user fa-fw"></i><b
						id="name">欢迎您！</b>
				</a>
				</li>
			</ul>
		</nav>
		<!-- Dropdown Structure -->
		<ul id="dropdown1" class="dropdown-content">
			<li><a href="#"><i class="fa fa-gear fa-fw"></i> 设置</a></li>
			<li><a
				href="${pageContext.request.contextPath}/system/user/tologin"><i
					class="fa fa-sign-out fa-fw"></i>注销</a></li>
		</ul>
		<!--/. NAV TOP  -->
		<!--/. NAV TOP  -->
		<nav class="navbar-default navbar-side" role="navigation">
			<div class="sidebar-collapse">
				<ul class="nav" id="main-menu">

					<li><a class="waves-effect waves-dark"
						href="${pageContext.request.contextPath}/system/user/toindex2"><i
							class="fa fa-leaf"></i>首页</a></li>
					<li class="active"><a
						class="active-menu waves-effect waves-dark"><i
							class="fa fa-user"></i>用户管理<span class="fa arrow"></span>
					</a>
						<ul class="nav nav-second-level">
							<li><a
								href="${pageContext.request.contextPath}/system/user/tousertable">用户列表</a>
							</li>
							<li><a
								href="${pageContext.request.contextPath}/system/user/toadd">添加用户</a>
							</li>
							<li><a
								href="${pageContext.request.contextPath}/system/user/toupdateuser"
								class="active-menu waves-effect waves-dark">修改用户</a></li>
						</ul></li>
					<li><a href="#" class="waves-effect waves-dark"><i
							class="fa fa-picture-o"></i>壁纸管理<span class="fa arrow"></span>
					</a>
						<ul class="nav nav-second-level">
							<li><a
								href="${pageContext.request.contextPath}/system/user/topicturetable">壁纸列表</a>
							</li>

						</ul></li>

				</ul>

			</div>

		</nav>
		<!-- /. NAV SIDE  -->
		<div id="page-wrapper">
			<div class="header">
				<h1 class="page-header">修改用户</h1>
				<ol class="breadcrumb">
					<li><a href="#">首页</a>
					</li>
					<li><a href="#">用户管理</a>
					</li>
					<li class="active">修改用户</li>
				</ol>

			</div>

			<div id="page-inner">
				<div class="row">
					<div class="col-lg-12">
						<div class="card">
							<div class="card-content">
								<form>
									<div class="form-group">
										<label class="font">用户ID</label> <input type="text"
											class="form-control" name="userid" id="userid"
											value="${user.userid}" disabled="disabled">
									</div>
									<div class="form-group">
										<label class="font">账号</label> <input type="text"
											class="form-control" name="username" id="username"
											value="${user.username}">
									</div>

									<div class="form-group">
										<label class="font">用户名</label> <input type="text"
											class="form-control" name="name" id="name"
											value="${user.name}">
									</div>
									<div class="form-group">
										<label class="font">原密码</label> <input type="text"
											class="form-control" name="password2" id="password2">
									</div>
									<div class="form-group">
										<label class="font">新密码</label> <input type="text"
											class="form-control" name="password" id="password"
											value="${user.password}">
									</div>


									<button type="button" class="btn btn-default"
										onclick="regist()">修改</button>
								</form>

							</div>
						</div>
					</div>
				</div>

				<footer>
					<p>
						<small> Designed by <a href="#">WSG</a> The home of the
							wallpaper <a href="#" target="_blank">壁纸之家</a> - Worth having</small>
					</p>
				</footer>
			</div>
			<!-- /. PAGE INNER  -->
		</div>
		<!-- /. PAGE WRAPPER  -->
	</div>
	<!-- /. WRAPPER  -->
	<!-- JS Scripts-->
	<!-- jQuery Js -->
	<script
		src="${pageContext.request.contextPath}/assets/js/jquery-1.10.2.js"></script>

	<!-- Bootstrap Js -->
	<script
		src="${pageContext.request.contextPath}/assets/js/bootstrap.min.js"></script>

	<script
		src="${pageContext.request.contextPath}/assets/materialize/js/materialize.min.js"></script>

	<!-- Metis Menu Js -->
	<script
		src="${pageContext.request.contextPath}/assets/js/jquery.metisMenu.js"></script>
	<!-- Morris Chart Js -->
	<script
		src="${pageContext.request.contextPath}/assets/js/morris/raphael-2.1.0.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/assets/js/morris/morris.js"></script>


	<script
		src="${pageContext.request.contextPath}/assets/js/easypiechart.js"></script>
	<script
		src="${pageContext.request.contextPath}/assets/js/easypiechart-data.js"></script>

	<script
		src="${pageContext.request.contextPath}/assets/js/Lightweight-Chart/jquery.chart.js"></script>

	<!-- Custom Js -->
	<script
		src="${pageContext.request.contextPath}/assets/js/custom-scripts.js"></script>


</body>

</html>
